package com.tql.view.service.impl;

import com.github.pagehelper.PageHelper;
import com.tql.view.mapper.UserMapper;
import com.tql.view.pojo.User;
import com.tql.view.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class UserServiceImpl implements UserService {
    @Autowired
    private UserMapper userMapper;
    @Override
    public User getUserByAccount(String account) {
        return userMapper.getUserByAccount(account);
    }

    @Override
    public void updateInfomation(Map<String,Object> params) {
        userMapper.updateInfomation(params);
    }

    @Override
    public void userRegist(Map<String, Object> params) {
        userMapper.userRegist(params);
    }

    @Override
    public void addCollect(Map<String, Object> params) {
        userMapper.addCollect(params);
    }

    @Override
    public List<User> selectAllUser(Integer page, Integer size) {
        PageHelper.startPage(page,size);
        return userMapper.selectAllUser(page,size);
    }

    @Override
    public void deleteUser(String account) {
        userMapper.deleteUser(account);
    }

    @Override
    public List<User> getAllUser() {
        return userMapper.getAllUser();
    }

    @Override
    public void updateReward(String account) {
        userMapper.updateReward(account);
    }

    @Override
    public int getReward(String account) {
        return  userMapper.getReward(account);
    }

    @Override
    public void updateBackGround(String background,String account) {
        userMapper.updateBackGround(background,account);
    }

    @Override
    public String getBackCround1(String account) {
        return userMapper.getBackCround1(account);
    }

    @Override
    public void updateReward1(String account) {
        userMapper.updateReward1(account);
    }

    @Override
    public void updateReward2(String account, int moneny) {
        userMapper.updateReward2(account,moneny);
    }
}
